package lab9;

public class Person {
	private long id;
	private static long currentID=0;
	private String name;
	private int age;
	private int iq;
	private int money;
	private int happiness;
	private Person friend;
	public Person(String name, int age, int iq, int money, int happiness) {
		super();
		this.id=currentID++;
		this.name = name;
		this.age = age;
		this.iq = iq;
		this.money = money;
		this.happiness=happiness;
		this.friend=this;
	}
	public Person getFriend() {
		return friend;
	}
	public void setFriend(Person friend) {
		this.friend = friend;
	}
	public void getDrunk() {
		if (money>0)
		{
			money--;
			happiness++;
			iq--;
		}
		else System.out.println("No money.");
	}	
	@Override
	public String toString() {
		return "Person [id=" + id + ", name=" + name + ", age=" + age + ", iq="
				+ iq + ", money=" + money + ", happiness=" + happiness
				+ ", friend=" + friend.getName() + "]";
	}
	public void growUp(){
		System.out.println("Time has been unkind to " + name + ".");
		age++;
	}
	public void eat(){
		System.out.println(name + " just ate.");
		happiness++;
		money--;
	}
	public void walk(){
		System.out.println(name + "'s gonna walk 500 miles.");
		happiness++;
	}
	public void drinkWater(double liters){
		System.out.println(name + " just drank " + liters + " liters of water.");
		happiness+=(int)(liters/2);	
		money-=(int)(liters/5);
	}
	public int getHappiness() {
		return happiness;
	}
	public void setHappiness(int happiness) {
		this.happiness = happiness;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public int getAge() {
		return age;
	}
	public void setAge(int age) {
		this.age = age;
	}
	public int getIq() {
		return iq;
	}
	public void setIq(int iq) {
		this.iq = iq;
	}
	public int getMoney() {
		return money;
	}
	public void setMoney(int money) {
		this.money = money;
	}
	public long getId() {
		return id;
	}
}
